<?php
	function check_database_status($val)
	{
		$number = $val;
		$result = 0;
		
		if($number == 1)
		{
		
			$db_status = 0;
		
			$select_DB = mysql_select_db(DB_NAME);
			if($select_DB)
			{
				$result = 1;
			}
		}
		
		return $result;
	}

	if(SETTING_CHECK_DB == 1)	// Auto create DB if not exists
	{
		function check_database($val)
		{
			$number = $val;
			$result = 0;
			
			if($number == 1)
			{
				$select_DB = mysql_select_db(DB_NAME);
				if(!$select_DB)		// create database if not exists
				{
					$sql = "CREATE DATABASE IF NOT EXISTS ".DB_NAME." CHARACTER SET utf8 COLLATE utf8_unicode_ci ";
					$exe = mysql_query($sql) or die(mysql_error());
					
					$result = 1;
				}
			}
			
			return $result;
		}
	}
?>